<?php
header("Content-type:text/html;charset=utf8");

class Site{
    // 成员变量
    var $url;
    var $title;

    // 成员函数
    function setUrl($par){
        $this->url=$par;
    }
    function getUrl(){
        echo $this->url.PHP_EOL;
    }
    function setTitle($par){
        $this->title=$par;
    }
    function getTitle(){
        echo $this->title.PHP_EOL;
    }
}
$youJ=new site;
$taoBao=new site;
$google=new site;

//调用成员函数,设置标题和URL
$youJ->setTitle("w3cschool的链接");
$taoBao->setTitle("淘宝");
$google->setTitle("google搜索");

$youJ->setUrl("http://www.w3cschool.com");
$taoBao->setUrl("http://www.taoboa.com");
$google->setUrl("http://www.google.com");

//调用成员函数,获取标题和url
$youJ->getTitle();
$taoBao->getTitle();
$google->getTitle();

$youJ->getUrl();
$taoBao->getUrl();
$google->getUrl();    

